<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>夺宝订单</title>
<link href="/resource/admin/css/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/resource/admin/js/jquery.js"></script>
<script type="text/javascript" src="/resource/admin/js/common.js"></script>
<script type="text/javascript" src="/resource/admin/js/list.js"></script>
<script type="text/javascript" src="/resource/admin/layer/layer.js"></script>
<script type="text/javascript" src="/resource/admin/datePicker/WdatePicker.js"></script>
<script type="text/javascript">
$().ready(function() {
	[@flash_message /]

    //渠道商查询
    var $dbProductTypeSel=$("#dbProductTypeSel");
    var $dbProductSel=$("#dbProductSel");
    var $dbTimesSel=$("#dbTimesSel");

    var productTypeId='${eq_long_productTId}';
    var productId='${eq_long_productId}';
    if(productId!=''){
        buildDbTimesSelect(productId);
    }

    $dbProductSel.change(function(){
        var productId=$(this).find("option:selected").val();
        buildDbTimesSelect(productId);
    });

    function buildDbProductTypeSelect(productTypeId){
        $dbTimesSel.empty();
        $.ajax({
            url: "/dbProduct/jsonList",
            type: "GET",
            data: {
                productId: productId
            },
            dataType: "json",
            cache: false,
            success: function(data) {
                if(data.type=='success'){
                    var optionHtml="<option value=''>所有</option>";
                    $(data.list).each(function(index,entity){
                        var timesId='${eq_long_dbTimes_id}';
                        if(timesId==entity.id){
                            optionHtml=optionHtml+"<option value='"+entity.id+"'  selected='selected'>"+entity.timesNo+"</option>"
                        }else{
                            optionHtml=optionHtml+"<option value='"+entity.id+"'>"+entity.timesNo+"</option>"
                        }

                    });
                    $(optionHtml).appendTo($dbTimesSel);
                }
            }
        });
    }

    function buildDbTimesSelect(productId){
        $dbTimesSel.empty();
        $.ajax({
            url: "/dbTimes/jsonList",
            type: "GET",
            data: {
                productId: productId
            },
            dataType: "json",
            cache: false,
            success: function(data) {
                if(data.type=='success'){
                    var optionHtml="<option value=''>所有</option>";
                    $(data.list).each(function(index,entity){
                        var timesId='${eq_long_dbTimes_id}';
                        if(timesId==entity.id){
                            optionHtml=optionHtml+"<option value='"+entity.id+"'  selected='selected'>"+entity.timesNo+"</option>"
                        }else{
                            optionHtml=optionHtml+"<option value='"+entity.id+"'>"+entity.timesNo+"</option>"
                        }

                    });
                    $(optionHtml).appendTo($dbTimesSel);
                }
            }
        });
    }


    /** 手动退款 */
    $(".go-refund").click(function(){
        var url=$(this).attr("href");
        layer.confirm('确定手动退款?', {
            btn: ['确定','取消'], //按钮
            shade: false //不显示遮罩
        }, function(){
            ajaxToDo(url,function(json){
                if(json.type=="success"){
                    layer.msg(json.content, {icon: 1});
                    $("#listForm").reload();
                }else{
                    layer.msg(json.content, {icon: 1});
                }
            })
        });
        return false;
    });
});
</script>
</head>
<body>
    <!-- 地址导航-->
	<div class="path">
		<a href="${base}/admin/common/index.do">首页</a> &raquo;夺宝订单<span>${page.total}</span>;金额:${amount}
	</div>
    <!-- 主体-->
	<form id="listForm" action="listAll" method="get">
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>
                        产品分类：
                        <select name="eq_long_productTypeId" class="text"id="dbProductTypeSel">
                            <option value="">所有</option>
                        [#list dbProductTypeList as dbProductType]
                            <option value="${dbProductType.id}" [#if dbProductType.id==eq_long_dbProductTypeId] selected="selected" [/#if]>${dbProductType.name}</option>
                        [/#list]
                        </select>
                    </td>
                    <td>
                        夺宝商品：
                        <select name="eq_long_productId" class="text" id="dbProductSel">
                            <option value="">所有</option>
                            [#list dbProductList as dbProduct]
                                 <option value="${dbProduct.id}" [#if dbProduct.id==eq_long_productId] selected="selected" [/#if]>${dbProduct.name}</option>
                            [/#list]
                        </select>
                    </td>
                    <td>
                        夺宝期：
                        <select name="eq_long_dbTimes.id" class="text"  id="dbTimesSel">
                            <option value="">所有</option>
                        </select>
                    </td>
                    <td>
                        手机号：<input type="text" name="eq_mobile" class="text" value="${eq_mobile}" />
                    </td>
                </tr>
                <tr>
                    <td>
                        支付状态：
                        <select name="eq_int_paymentStatus" class="text">
                            <option value="">所有</option>
                            <option value="0" [#if eq_int_paymentStatus==0]selected='selected'[/#if]>未支付</option>
                            <option value="1" [#if eq_int_paymentStatus==1]selected='selected'[/#if]>已支付</option>
                            <option value="2" [#if eq_int_paymentStatus==2]selected='selected'[/#if]>已退款</option>
                        </select>
                    </td>
                    <td>
                        支付方式：
                        <select name="eq_paymentMethodName" class="text">
                            <option value="">所有</option>
                            <option value="localVirtualPayPlugin" [#if eq_paymentMethodName=='localVirtualPayPlugin']selected='selected'[/#if]>宝币余额</option>
                            <option value="wo3DirectPlugin" [#if eq_paymentMethodName=='wo3DirectPlugin']selected='selected'[/#if]>话费购</option>
                        </select>
                    </td>
                    <td>
                        开始时间：<input type="text" id="beginDate" name="gt_datetime_createDate" class="text Wdate" readonly="readonly"  value="[#if gt_datetime_createDate??]${gt_datetime_createDate?string("yyyy-MM-dd HH:mm:ss")}[#else]${beginData?string("yyyy-MM-dd HH:mm:ss")}[/#if]" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss', maxDate: '#F{$dp.$D(\'endDate\')}' });"/>
                    </td>
                    <td>
                        结束时间：<input type="text" id="endDate" name="lt_datetime_createDate" class="text Wdate"  readonly="readonly"   value="[#if lt_datetime_createDate??]${lt_datetime_createDate?string("yyyy-MM-dd HH:mm:ss")}[#else]${endData?string("yyyy-MM-dd HH:mm:ss")}[/#if]"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate: '#F{$dp.$D(\'beginDate\')}',maxDate: '${currentDate}'});"/>
                    </td>
                    <td>
                        <button type="submit">检索</button>
                    </td>
                </tr>
            </table>
        </div>
		<div class="bar">
			<div class="buttonWrap">
				<a href="javascript:;" id="deleteButton" class="iconButton disabled">
					<span class="deleteIcon">&nbsp;</span>删除
				</a>
				<a href="javascript:;" id="refreshButton" class="iconButton">
					<span class="refreshIcon">&nbsp;</span>刷新
				</a>
				<div class="menuWrap">
					<a href="javascript:;" id="pageSizeSelect" class="button">
					    每页条数<span class="arrow">&nbsp;</span>
					</a>
                    <div class="popupMenu">
                        <ul id="pageSizeOption">
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 10] class="current"[/#if] val="10">10</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 20] class="current"[/#if] val="20">20</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 50] class="current"[/#if] val="50">50</a>
                            </li>
                            <li>
                                <a href="javascript:;"[#if page.numPerPage == 100] class="current"[/#if] val="100">100</a>
                            </li>
                        </ul>
                    </div>
				</div>
			</div>
		</div>
		<table id="listTable" class="list">
			<tr>
				<th class="check">
					<input type="checkbox" id="selectAll" />
				</th>
                <th>
                    <span>订单ID</span>
                </th>
				<th>
                    <span>订单编号</span>
				</th>
                <th>
                    <span>订单商品</span>
                </th>
                <th>
                    <span>夺宝期数</span>
                </th>
                <th>
                    <span>购买份数</span>
                </th>
                <th>
                    <span>付款金额</span>
                </th>
                <th>
                    <span>夺宝用户</span>
                </th>
                <th>
                    <span>支付状态</span>
                </th>
                <th>
                    <span>订单状态</span>
                </th>
                <th>
                    <span>是否中奖</span>
                </th>
                <th>
                    <span>IP(地址)</span>
                </th>
                <th>
                    <span>创建时间</span>
                </th>
                <th>操作</th>
			</tr>
			[#list page.content as entity]
				<tr>
					<td>
						<input type="checkbox" name="ids" value="${entity.id}" />
					</td>
                    <td>
                        ${entity.id}
                    </td>
					<td>
                       ${entity.sn}
					</td>
                    <td>
                        ${entity.name}
                    </td>
                    <td>
                        <a href="/dbTimes/edit?id=${entity.dbTimes.id}">${entity.dbTimes.timesNo}</a>
                    </td>
                    <td>
                        ${entity.quantity}
                    </td>
                    <td style="color: #cc0000;">
                        ${entity.amount}
                    </td>
                    <td>
                       <a href="/member/edit?id=${entity.memberId}"> ${entity.mobile}</a>
                    </td>
                    <td>
                        [#if entity.paymentStatus==0]<span style="color: grey;">未支付</span>[/#if]
                        [#if entity.paymentStatus==1]<span style="color: darkgreen;font-weight: bold;">已支付</span>[/#if]
                        [#if entity.paymentStatus==2]<span style="color: #cc0000;font-weight: bold;">已退款</span>[/#if]
                    </td>
                    <td>
                        [#if entity.orderStatus==0]已确认[/#if]
                        [#if entity.orderStatus==1]已完成[/#if]
                        [#if entity.orderStatus==2]已取消[/#if]
                    </td>
                    <td>
                        [#if entity.isLottery==true]
                            是&nbsp;
                            [#if entity.shippingDate??]
                                [#if entity.shippingStartDate??]
                                     [#if entity.shippingEndDate]
                                          已经收货
                                          [#else]等待收货
                                     [/#if]
                                    [#else]<a href="/dbTimes/shipping?id=${entity.id}" class="layer-dialog">马上发货</a>
                                [/#if]
                                [#else]等待确认地址
                            [/#if]
                        [/#if]
                    </td>
                    <td>
                       ${entity.ip} ${entity.fromAddress}
                    </td>
                    <td>
                        ${entity.createDate?string("yyyy-MM-dd HH:mm:ss")}
                    </td>
                    <td>
                        <a href="edit?id=${entity.id}">[详情]</a>
                        [#if entity.isRefund!=true&&entity.codeInfo==null&&entity.paymentStatus==1]
                             <a href="refund?orderId=${entity.id}" class="go-refund">[退款]</a>
                        [/#if]
                    </td>
				</tr>
			[/#list]
		</table>
       [@pagination pageNumber = page.pageNumber totalPages = page.totalPages]
             [#include "/common/pagination.ftl"]
       [/@pagination]

	</form>
</body>
</html>